namespace ClassyBlog.Infrastructure.Specs.Unit
{
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    using Machine.Specifications;

    [Subject(typeof(DefaultBuildManager))]
    public abstract class DefaultBuildManagerSpec
    {
        protected static DefaultBuildManager buildManager;

        Establish conttext = () => buildManager = new DefaultBuildManager();
    }

    [Subject(typeof(DefaultBuildManager))]
    public class when_private_assemblies_are_accessed_in_non_web_environment :
        DefaultBuildManagerSpec
    {
        static IEnumerable<Assembly> assemblies;

        Because of = () => assemblies = buildManager.PrivateAssemblies;

        It should_be_empty = () => assemblies.ShouldBeEmpty();
    }

    [Subject(typeof(DefaultBuildManager))]
    public class when_checking_whether_a_file_exists_in_non_web_environment :
        DefaultBuildManagerSpec
    {
        static bool exists;

        Because of = () => exists =
            buildManager.FileExists("~/somefile.cshtml");

        It should_be_false = () => exists.ShouldBeFalse();
    }

    [Subject(typeof(DefaultBuildManager))]
    public class when_getting_compiled_type_in_non_web_environment :
        DefaultBuildManagerSpec
    {
        static Type type;

        Because of = () => type =
            buildManager.GetCompiledType("~/somefile.cshtml");

        It should_be_null = () => type.ShouldBeNull();
    }
}